<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"  %>
<%@taglib uri="http://www.springframework.org/security/tags"  prefix="sec"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">
    <meta name="_csrf" content="${_csrf.token}"/>
    <!-- default header name is X-CSRF-TOKEN -->
    <meta name="_csrf_header" content="${_csrf.headerName}"/>


    <title>Signin Template for Bootstrap</title>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="css/signin.css" rel="stylesheet">
<script type="text/javascript" src="js/jquery-1.9.1.js"></script>
    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <script src="js/loginPage/ie-emulation-modes-warning.js"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<script type="text/javascript">

$(function (){
    $("#rand").click(function () {
        $(this).attr('src', '/kaptcha.jpg?' + Math.floor(Math.random() * 100));
    });

});
</script>
<body>

<div class="container">

    <form:form class="form-signin" action="/login" method="POST" name="f"
          role="form" >
        <h2 class="form-signin-heading">Please sign in</h2>
        <label for="inputEmail" class="sr-only">Email address</label>
        <input type="email" id="inputEmail" class="form-control"  name='username' placeholder="Email address" required autofocus>
        <label for="inputPassword" class="sr-only">Password</label>
        <input type="password" id="inputPassword" class="form-control"  name="password" placeholder="Password" required>
        <c:if test="${not empty param.login_error}">
            <font color="red">
                登录失败，请重试.<br/><br/>
                原因:<c:out value="${SPRING_SECURITY_LAST_EXCEPTION.message}"/>
            </font>
        </c:if>
        <div class="checkbox">
            <label>
                <input type="checkbox" value="remember-me"> Remember me
            </label>
        </div>
        <input type="hidden"
               name="${_csrf.parameterName}"
               value="${_csrf.token}"/>
        <img id="rand" src="kaptcha.jpg"/><input type="text" name="code" id="code"
                                                        class="input" style="width: 80px;" />
        <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
        <input class="btn btn-lg btn-primary btn-block" type="button" onclick="register()" value="注册"/>
    </form:form>

<br>

</div> <!-- /container -->


<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="js/loginPage/ie10-viewport-bug-workaround.js"></script>
</body>
</html>
